<?php
class AppController extends Controller {
    var $components = array('scoring','Session');
    var $uses = array('User');
    function beforeFilter()
    {
        if(isset($this->params['admin']) && $this->Session->read('User.role')!='admin')
		{
			$this->Session->setFlash('Access Denied');
			$this->redirect('/brands/login');
		}
    }
	
	function covertArray($records,$model,$key='id',$value='name')
    {
        $data = array();
        foreach($records as $record)
        {
            $data[$record[$model][$key]] = $record[$model][$value]; 
        }
        return $data;
    }
}
?>
